//
//  WalletCentreCell.swift
//  TianTianBiTing
//
//  Created by Gox mac 2 on 2019/1/3.
//  Copyright © 2019 Gox_WallyDiao. All rights reserved.
//

import UIKit

class WalletCentreCell: UICollectionViewCell {
    var backView = UIView.init()
    var topLabel = UILabel.init()
    var centreLabel = UILabel.init()
    var bottomLabel = UILabel.init()
    var imageView = UIImageView.init()
    override init(frame: CGRect) {
        super.init(frame: frame)
        setUI()
    }
    
    func setUI() {
        
        self.contentView.addSubview(self.backView)
        self.backView.addSubview(self.topLabel)
        self.backView.addSubview(self.centreLabel)
        self.backView.addSubview(self.bottomLabel)
        self.backView.addSubview(self.imageView)
        
        self.backView.layer.borderWidth = 1
        self.backView.layer.cornerRadius = 3
        self.topLabel.textAlignment = .center
        self.centreLabel.textAlignment = .center
        self.bottomLabel.textAlignment = .center
        
        self.topLabel.font = Font_Medium(14)
        self.centreLabel.font = Font_Regular(11)
        self.bottomLabel.font = Font_Regular(10)
        self.bottomLabel.textColor = RGB(230, 67, 64)
        
        self.imageView.image = IMAGE(name: "火焰")
        self.imageView.isHidden = true
        
        setNoSelector()
        
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
        
        
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        let contentWidth = self.contentView.bounds.size.width
        
        self.backView.frame = FRAME_CGFloat(0, 10, contentWidth, 61)
        self.topLabel.frame = FRAME_CGFloat(0, 5, contentWidth, 20)
        self.centreLabel.frame = FRAME_CGFloat(0, 25, contentWidth, 15)
        self.bottomLabel.frame = FRAME_CGFloat(0, 42, contentWidth, 14)
        self.imageView.frame = FRAME_CGFloat(3.5, 0, 16, 20)
    }
    
    func setNoSelector() {
        
        self.backView.layer.borderColor = RGB_Same(240).cgColor
        self.topLabel.textColor = RGB_Same(53)
        self.centreLabel.textColor = RGB_Same(53)
        
    }
    
    func setSelector() {
        self.backView.layer.borderColor = RGB(230, 67, 64).cgColor
        self.topLabel.textColor = RGB(230, 67, 64)
        self.centreLabel.textColor = RGB(230, 67, 64)
        
    }
    
}
